
let sendCode = async (to,code)=>{
const nodeMailer = require('nodemailer');

let transporter = nodeMailer.createTransport({
    host:'smtp.qq.com',
    secure:true,
    port:465,
    auth:{
        user:'2215775451@qq.com',
        pass:'gdoztvlsprdfdjfa'
    }
})

var mailOptions = {
    from:`"来自CCMWN留言墙"<2215775451@qq.com>`,
    to:to,
    subject:'欢迎您来到CCMWN留言墙',
    html:`<h1>您的验证码为 <span style='color:red'>${code}</span></h1>`
}

transporter.sendMail(mailOptions,(err,info)=>{
        if (err) {
            console.log(err);
            
        } else {
            console.log(info);
        }
})
}




exports.sendCode=sendCode